home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
kernel
/
stmpx.s.D
< prev
next >
Wrap
Text File
|
1990-07-25
|
6KB
|
277 lines
*** /tmp/,RCSt1022335 Wed Jul 25 13:56:07 1990
--- stmpx.s Sun Jul 15 08:29:11 1990
***************
*** 1,2 ****
! #ifdef ATARI_ST
--- 1,4 ----
! #include <minix/config.h>
! #include "const.h"
! #if (CHIP == M68000)
***************
*** 26,27 ****
--- 28,30 ----
.define _lock
+ .define _unlock
.define _restore
***************
*** 37,43 ****
!
.extern _proc_ptr
- .extern _cur_proc
.extern _rdy_head
! .extern _pick_proc
! .extern _t_stack
.extern _main
--- 40,47 ----
!
+ .extern _clock_handler
+ .extern _held_head
+ .extern _k_reenter
.extern _proc_ptr
.extern _rdy_head
! .extern _lock_pick_proc
.extern _main
***************
*** 47,49 ****
.extern _timint
- .extern _clockint
.extern _dmaint
--- 51,52 ----
***************
*** 58,66 ****
!
- ! manifest constants to be included from kernel/const.h
- !
- TASK_STACK_BYTES= 1024
- IDLE = -999
- TASK_Q = 0
-
- !
! offsets into a proc table entry
--- 61,62 ----
***************
*** 69,73 ****
savsp = 60
! savsr = 64
! savpc = 66
! savtt = 75
--- 65,69 ----
savsp = 60
! savpc = 64
! savsr = 68
! savtt = 77
***************
*** 79,81 ****
.data2 0x0400, trp, 0x0500, trp, 0x0600, trp, 0x0700, trp
! .data2 0x0800, trp, 0x0900, trp, 0x0A00, trp, 0x0B00, trp
.data2 0x0C00, trp, 0x0D00, trp, 0x0E00, trp, 0x0F00, trp
--- 75,77 ----
.data2 0x0400, trp, 0x0500, trp, 0x0600, trp, 0x0700, trp
! .data2 0x0800, trp, 0x0900, trc, 0x0A00, trp, 0x0B00, trp
.data2 0x0C00, trp, 0x0D00, trp, 0x0E00, trp, 0x0F00, trp
***************
*** 153,155 ****
move.w #0x2700,sr
! move.l #_t_stack+TASK_STACK_BYTES,sp
! move.l #_end,d0
--- 149,151 ----
move.w #0x2700,sr
! move.l #k_stktop,sp
! move.l #_end,d0
***************
*** 171,173 ****
trp:
! jsr save
jsr _trap
--- 167,169 ----
trp:
! bsr save
jsr _trap
***************
*** 174,177 ****
bra restart
int:
! jsr save
jsr _rupt
--- 170,177 ----
bra restart
+ trc:
+ btst #5,(sp) ! tracing through trap?
+ beq trp ! No, do normal trace processing
+ rte ! don't trace; execute system call
int:
! bsr save
jsr _rupt
***************
*** 179,181 ****
non:
! jsr save
jsr _none
--- 179,181 ----
non:
! bsr save
jsr _none
***************
*** 183,185 ****
sys:
! jsr save ! d0, d1 and a0 not modified
move.l a0,-(sp) ! m_ptr
--- 183,185 ----
sys:
! bsr save ! d0, d1 and a0 not modified
move.l a0,-(sp) ! m_ptr
***************
*** 186,191 ****
move.w d1,-(sp) ! src_dest
- move.w _cur_proc,-(sp) ! caller
move.w d0,-(sp) ! SEND/RECEIVE/BOTH
! jsr _sys_call ! sys_call(func,caller,src_dest,m_ptr)
! add.l #10,sp
bra restart
--- 186,193 ----
move.w d1,-(sp) ! src_dest
move.w d0,-(sp) ! SEND/RECEIVE/BOTH
! move.l _proc_ptr,a6 ! needed to store return value
! ! warning: _sys_call may change _proc_ptr
! jsr _sys_call ! sys_call(func,src_dest,m_ptr)
! move.l d0,(a6)
! add.l #8,sp
bra restart
***************
*** 203,206 ****
clk:
movem.l FREEREGS,-(sp)
! move.l #_clockint,a0
bsr async
--- 205,213 ----
clk:
+ sub.w #1,clkcnt
+ beq cont
+ rte
+ cont:
+ move.w #4,clkcnt
movem.l FREEREGS,-(sp)
! move.l #_clock_handler,a0
bsr async
***************
*** 244,245 ****
--- 251,253 ----
move.w d0,(sp) ! push traptype as argument
+ add.b #1,_k_reenter ! from -1 if not reentering
jsr (a0) ! call service routine
***************
*** 247,259 ****
move.w #0x2700,sr
movem.l (sp)+,FREEREGS
- cmp.l #0,_rdy_head+TASK_Q ! any task just readied?
- beq L3 ! no: branch and return from interrupt
btst #5,(sp) ! previously in kernel mode?
! beq L4 ! no: branch and do task switch
! ! the next test is rather machine dependent
! ! for the Atari ST test for previous processor priority >= 4
! btst #2,(sp) ! interrupting interrupt?
bne L3 ! yes: branch and return from interrupt
! cmp.w #IDLE,_cur_proc ! kernel mode but IDLE?
! beq L4 ! yes: branch and do task switch
L3:
--- 255,263 ----
move.w #0x2700,sr
+ sub.b #1,_k_reenter
movem.l (sp)+,FREEREGS
btst #5,(sp) ! previously in kernel mode?
! ! (interrupted a task or another interrupt)
bne L3 ! yes: branch and return from interrupt
! cmp.l #0,_rdy_head+TASK_Q ! any task just readied?
! bne L4 ! yes: branch and do task switch
L3:
***************
*** 261,264 ****
L4:
! jsr save
! jsr _pick_proc
bra restart
--- 265,268 ----
L4:
! bsr save
! jsr _lock_pick_proc
bra restart
***************
*** 283,285 ****
move.l (sp)+,savpc(a6) ! pc
! move.l #_t_stack+TASK_STACK_BYTES,sp
jmp (a1)
--- 287,289 ----
move.l (sp)+,savpc(a6) ! pc
! add.b #1,_k_reenter ! from -1 if not reentering
jmp (a1)
***************
*** 287,292 ****
restart:
jsr _checksp
- move.w #0x2700,sr ! ?
- cmp.w #IDLE,_cur_proc
- beq idle
move.l _proc_ptr,a6
--- 291,306 ----
restart:
+ ! Flush any held-up interrupts.
+ ! This reenables interrupts, so the current interrupt handler may reenter.
+ ! This doesn't matter, because the current handler is about to exit and no
+ ! other handlers can reenter since flushing is only done when k_reenter == 0.
+
+ move.w #0x2700,sr
+ tst.b _k_reenter
+ bne over_call_unhold
+ cmp.l #0,_held_head
+ beq over_call_unhold
+ jsr _unhold
+ over_call_unhold:
+ sub.b #1,_k_reenter
jsr _checksp
move.l _proc_ptr,a6
***************
*** 303,310 ****
- idle:
- .extern _idle
- jsr _idle
- L8: stop #0x2200 ! wait enabled.
- bra L8
-
_lock:
--- 317,318 ----
***************
*** 316,319 ****
rts
- #ifdef NEEDED
- .define _unlock
_unlock:
--- 324,325 ----
***************
*** 321,323 ****
rts
- #endif
_reboot:
--- 327,328 ----
***************
*** 345,346 ****
--- 350,356 ----
+ clkcnt: .data2 4
+
+ .space K_STACK_BYTES
+ k_stktop:
+
#ifdef ACK
***************
*** 358,359 ****
! #endif ATARI_ST
--- 368,369 ----
! #endif